<% layout('/layouts/default.html', {title: '诊所管理', libs: ['validate','fileupload','ueditor']}){ %>
<style>
	.nav-tabs>li.active>a, .nav-tabs>li.active>a:focus, .nav-tabs>li.active>a:hover{
		background-color: #f3ecec;
	}

	.nav{
		margin-bottom: 10px;
	}
</style>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-trophy"></i> ${text(clinic.isNewRecord ? '新增诊所' : '编辑诊所')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${clinic}" action="${ctx}/fl/clinic/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<#form:hidden path="id"/>

				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('诊所名称')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:input path="name" maxlength="200" class="form-control required "
									remote="${ctx}/fl/clinic/checkClinicName?oldClinicName=${clinic.name}"
									data-msg-remote="${text('诊所名称已存在')}"/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('英文名称')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:input path="enName" maxlength="50" class="form-control required "/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('诊所简称')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:input path="shortName" maxlength="20" class="form-control required "/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('所在省份')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:select path="province.id" items="${mapList}" itemLabel="areaName" itemValue="id" blankOption="true" class="form-control required "/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('所在城市')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:select path="city.id" items="${cityList}" itemLabel="areaName" itemValue="id" blankOption="true" class="form-control required"/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('详细地址')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:input path="address" maxlength="200" class="form-control required "/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('英文详细地址')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:input path="enAddress" maxlength="200" class="form-control required "/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								${text('地图坐标')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-7">
								<#form:input path="coord" maxlength="200" class="form-control"/>
							</div>
							<div class="col-sm-2">
								<input id="btnGetpoint" class="btn btn-inverse" type="button" value="坐标拾取"/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('联系电话')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:input path="telephone" maxlength="20" class="form-control required"/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('关联科室')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:checkbox path="departments" dictType="fl_department" class="form-control required"/>
							</div>
						</div>
					</div>
					
				</div>
				<ul id="tab-businessDays" class="nav nav-tabs col-xs-offset-2" role="tablist">
					<li  class="active"><a href="#businessDays-wechat" role="tab" data-toggle="tab">公众号营业时间</a></li>
					<li><a href="#businessDays-website" role="tab" data-toggle="tab">官网营业时间</a></li>
				</ul>
				<div id="tabContent-businessDays" class="tab-content">
					<div class="tab-pane active" id="businessDays-wechat">
						<div class="row">
							<div class="col-xs-12">
								<div class="form-group">
									<label class="control-label col-sm-3" title="">
										<span class="required">*</span> ${text('营业时间')}：<i class="fa icon-question hide"></i></label>
									<div class="col-sm-9">
										<#form:textarea path="businessDaysWechat" rows="4" maxlength="500" class="form-control required"/>
									</div>
								</div>
							</div>
						</div>
						<div class="row">
							<div class="col-xs-12">
								<div class="form-group">
									<label class="control-label col-sm-3" title="">
										<span class="required">*</span> ${text('英文营业时间')}：<i class="fa icon-question hide"></i></label>
									<div class="col-sm-9">
										<#form:textarea path="enBusinessDaysWechat" rows="4" maxlength="500" class="form-control required"/>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="tab-pane" id="businessDays-website">
						<div class="row">
							<div class="col-xs-12">
								<div class="form-group">
									<label class="control-label col-sm-3" title="">
										<span class="required ">*</span> ${text('营业时间')}：<i class="fa icon-question hide"></i></label>
									<div class="col-sm-9">
										<#form:ueditor path="businessDays" height="100" class="required" readonly="false" outline="false" simpleToolbars="false" maxlength="200"/>
									</div>
								</div>
							</div>

						</div>
						<div class="row">
							<div class="col-xs-12">
								<div class="form-group">
									<label class="control-label col-sm-3" title="">
										<span class="required ">*</span> ${text('英文营业时间')}：<i class="fa icon-question hide"></i></label>
									<div class="col-sm-9">
										<#form:ueditor path="enBusiness" height="100" class="required" readonly="false" outline="false" simpleToolbars="false" maxlength="200"/>
									</div>
								</div>
							</div>

						</div>
					</div>
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('可预约时间')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<div class="input-group ">
									<#form:checkbox path="businessHours" dictType="fl_week" class="form-control required"/>
								<!--input name="businessHours" id="businessHours" type="hidden" value="${clinic.businessHours}">
								<input name="businessHoursLabel" class="form-control required " readonly="readonly" id="businessHoursLabel" type="textarea" rows="4">
								<span class="input-group-btn"><a class="btn btn-default " id="testUserButton" href="javascript:"><i class="fa fa-wrench"></i></a></span-->
								</div>
									<!--script>
									$("#businessHoursLabel,#testUserButton").click(function(){
										var options = {
											type: 0,
											maxmin: true,
											shadeClose: true,
											title: '营业时间设置',
											area: ['600px', '400px'],
											content: $("#tpl-businessHours-edit").html(),
											success: function(layero, index){
												var businessHoursString = $("#businessHours").val();
												var businessHours;
												if(businessHoursString != null &&  businessHoursString.length>0){
													try{
														businessHours = JSON.parse(businessHoursString);
													}catch(e){
														businessHours = businessHoursString;
													}
												}
												if(businessHours!=null && businessHours.length>0){													
													$.each(businessHours, function (idx, item) {
														layero.context.getElementById("week" +item.name ).checked=true;
														layero.context.getElementById("startTime" +item.name ).value=item.startTime;
														layero.context.getElementById("endTime" +item.name ).value=item.endTime;
														
													});
												}else{
													for(var i =1;i<6;i++){
														layero.context.getElementById("week" + i).checked=true;
													}
												}

											},
											btn: ['<i class="fa fa-check"></i> 确定'],
											btn1: function(index, layero){	
												var businessHours = new Array();
												var week1 = layero.context.getElementById("week1").checked;
												var week2 = layero.context.getElementById("week2").checked;
												var week3 = layero.context.getElementById("week3").checked;
												var week4 = layero.context.getElementById("week4").checked;
												var week5 = layero.context.getElementById("week5").checked;
												var week6 = layero.context.getElementById("week6").checked;
												var week7 = layero.context.getElementById("week7").checked;
												var i = 0;
												if(week1){
													var startTime1 = layero.context.getElementById("startTime1").value;
													var endTime1 = layero.context.getElementById("endTime1").value;
													var week1 = new Object();
													week1.name="1";
													week1.startTime=startTime1;
													week1.endTime=endTime1;
													businessHours[i++]=week1;
												}
												if(week2){
													var startTime2 = layero.context.getElementById("startTime2").value;
													var endTime2 = layero.context.getElementById("endTime2").value;
													var week2 = new Object();
													week2.name="2";
													week2.startTime=startTime2;
													week2.endTime=endTime2;
													businessHours[i++]=week2;
												}
												if(week3){
													var startTime3 = layero.context.getElementById("startTime3").value;
													var endTime3 = layero.context.getElementById("endTime3").value;
													var week3 = new Object();
													week3.name="3";
													week3.startTime=startTime3;
													week3.endTime=endTime3;
													businessHours[i++]=week3;
												}
												if(week4){
													var startTime4 = layero.context.getElementById("startTime4").value;
													var endTime4 = layero.context.getElementById("endTime4").value;
													var week4= new Object();
													week4.name="4";
													week4.startTime=startTime4;
													week4.endTime=endTime4;
													businessHours[i++]=week4;
												}
												if(week5){
													var startTime5 = layero.context.getElementById("startTime5").value;
													var endTime5 = layero.context.getElementById("endTime5").value;
													var week5 = new Object();
													week5.name="5";
													week5.startTime=startTime5;
													week5.endTime=endTime5;
													businessHours[i++]=week5;
												}
												if(week6){
													var startTime6 = layero.context.getElementById("startTime6").value;
													var endTime6 = layero.context.getElementById("endTime6").value;
													var week6 = new Object();
													week6.name="6";
													week6.startTime=startTime6;
													week6.endTime=endTime6;
													businessHours[i++]=week6;
												}
												if(week7){
													var startTime7 = layero.context.getElementById("startTime7").value;
													var endTime7 = layero.context.getElementById("endTime7").value;
													var week7 = new Object();
													week7.name="7";
													week7.startTime=startTime7;
													week7.endTime=endTime7;
													businessHours[i++]=week7;
												}
												if(i==0){
													alert("不能一天都不选。请选择要设置的时间段");
													return false;
												}
												$("#businessHours").val(JSON.stringify(businessHours)).change();
												$("#businessHoursLabel").val(toLabel($("#businessHours").val())).change();
											}
										};
										options.btn.push('<i class="fa fa-toggle-on"></i> 全选');
										options['btn'+options.btn.length] = function(index, layero){
											layero.context.getElementById("week1").checked = true;
											layero.context.getElementById("week2").checked = true;
											layero.context.getElementById("week3").checked = true;
											layero.context.getElementById("week4").checked = true;
											layero.context.getElementById("week5").checked = true;
											layero.context.getElementById("week6").checked = true;
											layero.context.getElementById("week7").checked = true;
											return false;
										};
										options.btn.push('<i class="fa fa-close"></i> 关闭');
										js.layer.open(options);
									});
									</script-->
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required ">*</span> ${text('服务范围')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
									<#form:select path="serviceArea" dictType="fl_service_area" blankOption="true" class="form-control required"/>
							</div>
						</div>
					</div>
					
				</div>

				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								${text('可服务企业')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:select path="serviceEnterprise" items="${enterpriseList}" itemLabel="name" itemValue="id" blankOption="true" multiple="true" class="form-control"/>
							</div>
						</div>
					</div>
					
				</div>
				
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								${text('图片上传')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:fileupload id="upload3" returnPath="true" filePathInputId="picture" fileNameInputId="pictureName"
										uploadType="image" readonly="false" isMini="false" bizKey="${clinic.id}" bizType="clinic_picture"/>
								<#form:input readonly="true" path="picture" class="form-control"/>
								<#form:hidden path="pictureName" />
							</div>
						</div>
					</div>
					
				</div>

				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required hide">*</span> ${text('诊所介绍')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:textarea path="remarks" rows="4" maxlength="2000" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-3" title="">
								<span class="required hide">*</span> ${text('英文诊所介绍')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-9">
								<#form:textarea path="enDescriptions" rows="4" maxlength="2000" class="form-control"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-9">
						<% if (hasPermi('fl:clinic:edit')){ %>
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
						<% } %>
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>

$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});
</script>
<script type="text/template" id="tpl-businessHours-edit">
            <div class="col-sm-12 m-b-20" style="position:relative;">
                    <div class="row form-inline">
                    		<input type="checkbox" name="week1" id="week1" value="1">
                        <label class="control-label">星期一:</label>
                        <label class="control-label">开始时间:</label>
                        <select name="startTime1" id="startTime1" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1:30">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2:30">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3:30">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4:30">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5:30">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6:30">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7:30">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8:30">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9:30">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10:30">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11:30">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束时间:</label>
                        <select name="endTime1" id="endTime1" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13:30">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14:30">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15:30">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16:30">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17:30">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18:30">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19:30">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20:30">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21:30">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22:30">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23:30">23:30</Option>
                        </select>
                    </div>
                    <div class="row form-inline">
                        <input type="checkbox" name="week2" id="week2" value="1">
                        <label class="control-label">星期二:</label>
                        <label class="control-label">开始时间:</label>
                        <select name="startTime2" id="startTime2" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1:30">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2:30">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3:30">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4:30">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5:30">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6:30">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7:30">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8:30">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9:30">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10:30">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11:30">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束时间:</label>
                        <select name="endTime2" id="endTime2" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13:30">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14:30">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15:30">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16:30">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17:30">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18:30">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19:30">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20:30">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21:30">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22:30">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23:30">23:30</Option>
                        </select>
                    </div>
                    <div class="row form-inline">
                        <input type="checkbox" name="week3" id="week3" value="1">
                        <label class="control-label">星期三:</label>
                        <label class="control-label">开始时间:</label>
                        <select name="startTime3" id="startTime3" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1:30">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2:30">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3:30">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4:30">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5:30">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6:30">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7:30">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8:30">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9:30">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10:30">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11:30">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束时间:</label>
                        <select name="endTime3" id="endTime3" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13:30">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14:30">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15:30">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16:30">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17:30">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18:30">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19:30">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20:30">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21:30">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22:30">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23:30">23:30</Option>
                        </select>
                    </div>
                    <div class="row form-inline">
                    		<input type="checkbox" name="week4" id="week4" value="1">
                        <label class="control-label">星期四:</label>
                        <label class="control-label">开始时间:</label>
                        <select name="startTime4" id="startTime4" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1:30">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2:30">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3:30">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4:30">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5:30">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6:30">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7:30">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8:30">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9:30">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10:30">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11:30">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束时间:</label>
                        <select name="endTime4" id="endTime4" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13:30">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14:30">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15:30">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16:30">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17:30">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18:30">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19:30">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20:30">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21:30">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22:30">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23:30">23:30</Option>
                        </select>
                    </div>
                    <div class="row form-inline">
                    		<input type="checkbox" name="week5" id="week5" value="1">
                        <label class="control-label">星期五:</label>
                        <label class="control-label">开始时间:</label>
                        <select name="startTime5" id="startTime5" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1:30">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2:30">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3:30">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4:30">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5:30">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6:30">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7:30">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8:30">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9:30">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10:30">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11:30">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束时间:</label>
                        <select name="endTime5" id="endTime5" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13:30">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14:30">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15:30">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16:30">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17:30">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18:30">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19:30">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20:30">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21:30">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22:30">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23:30">23:30</Option>
                        </select>
                    </div>
                    <div class="row form-inline">
                    		<input type="checkbox" name="week6" id="week6" value="1">
                        <label class="control-label">星期六:</label>
                        <label class="control-label">开始时间:</label>
                        <select name="startTime6" id="startTime6" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1:30">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2:30">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3:30">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4:30">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5:30">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6:30">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7:30">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8:30">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9:30">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10:30">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11:30">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束时间:</label>
                        <select name="endTime6" id="endTime6" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13:30">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14:30">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15:30">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16:30">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17:30">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18:30">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19:30">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20:30">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21:30">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22:30">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23:30">23:30</Option>
                        </select>
                    </div>
                    <div class="row form-inline">
                    		<input type="checkbox" name="week7" id="week7" value="1">
                        <label class="control-label">星期日:</label>
                        <label class="control-label">开始时间:</label>
                        <select name="startTime7" id="startTime7" class="form-control">
                        	<option value="1">1</Option>
                        	<option value="1:30">1:30</Option>
                        	<option value="2">2</Option>
                        	<option value="2:30">2:30</Option>
                        	<option value="3">3</Option>
                        	<option value="3:30">3:30</Option>
                        	<option value="4">4</Option>
                        	<option value="4:30">4:30</Option>
                        	<option value="5">5</Option>
                        	<option value="5:30">5:30</Option>
                        	<option value="6">6</Option>
                        	<option value="6:30">6:30</Option>
                        	<option value="7">7</Option>
                        	<option value="7:30">7:30</Option>
                        	<option value="8">8</Option>
                        	<option value="8:30">8:30</Option>
                        	<option value="9" selected="true">9</Option>
                        	<option value="9:30">9:30</Option>
                        	<option value="10">10</Option>
                        	<option value="10:30">10:30</Option>
                        	<option value="11">11</Option>
                        	<option value="11:30">11:30</Option>
                        	<option value="12">12</Option>
                        </select>
                        <label class="control-label">结束时间:</label>
                        <select name="endTime7" id="endTime7" class="form-control">
                        	<option value="13">13</Option>
                        	<option value="13:30">13:30</Option>
                        	<option value="14">14</Option>
                        	<option value="14:30">14:30</Option>
                        	<option value="15">15</Option>
                        	<option value="15:30">15:30</Option>
                        	<option value="16">16</Option>
                        	<option value="16:30">16:30</Option>
                        	<option value="17" selected="true">17</Option>
                        	<option value="17:30">17:30</Option>
                        	<option value="18">18</Option>
                        	<option value="18:30">18:30</Option>
                        	<option value="19">19</Option>
                        	<option value="19:30">19:30</Option>
                        	<option value="20">20</Option>
                        	<option value="20:30">20:30</Option>
                        	<option value="21">21</Option>
                        	<option value="21:30">21:30</Option>
                        	<option value="22">22</Option>
                        	<option value="22:30">22:30</Option>
                        	<option value="23">23</Option>
                        	<option value="23:30">23:30</Option>
                        </select>
                    </div>
                </div>
</script>

<script>

function toLabel(businessHoursString){
	var businessHoursLabel = "";
	var businessHours;
	if(businessHoursString != null &&  businessHoursString.length>0){
		try{
			businessHours = JSON.parse(businessHoursString);
		}catch(e){
			businessHours = businessHoursString;
		}
	}
	if(businessHours!=null && businessHours.length>0){													
		$.each(businessHours, function (idx, item) {
			businessHoursLabel += "星期" + getWeekName(item.name)+":"+item.startTime+"-" + item.endTime+";";			
		});
	}
	return businessHoursLabel;
}

function getWeekName(name){
	if(name == "1"){
		return "一";
	}else if(name == "2"){
		return "二";
	}else if(name == "3"){
		return "三";
	}else if(name == "4"){
		return "四";
	}else if(name == "5"){
		return "五";
	}else if(name == "6"){
		return "六";
	}else{
		return "日";
	}
}

$('#btnGetpoint').click(function(){
	js.addTabPage(null, "坐标拾取", "https://lbs.qq.com/tool/getpoint/index.html", true, false);
});
	
var cityList = ${toJson(cityList)};
$("#province_id").change(function () {
		var provinceId = $("#province_id").val();
		
		$("#city_id").empty();
		$("#city_id").append("<option value=></option>");
      if (cityList && cityList.length > 0) {
          $.each(cityList, function (idx, item) {
          	if(item.parentCode == provinceId){
              $("#city_id").append("<option value=" + item.id + ">" + item.areaName + "</option>");
            }
          });
      }
});
$("#address").change(function () {
		var address = $("#address").val();
		$.get("http://restapi.amap.com/v3/geocode/geo?key=aa4a48297242d22d2b3fd6eddfe62217&s=rsv3&address="+address, function (reply) {
			if(reply.count > 0 ){
				$("#coord").val(reply.geocodes[0].location);
			}else{
				js.showMessage("取不到地址对应的地图坐标，请确认地址是否正确！");
			}
		});
});

</script>
